package org.jeecg.modules.business.third.strategy.emsdms;

import cn.hutool.core.util.ObjectUtil;
import org.jeecg.common.exception.JeecgBootException;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/*
 * 项目名称:    wms-server-jeecg
 * 接口描述:    //非sap，mes其他三方接口整合.包含了ems和dms 容器
 * 创建人员:    zhaojun
 * 创建时间:    2023-10-23
 */
@Component
@Lazy
public class ThirdOperateStrategyContext {

    public static Map<String, ThirdOperateStrategy> strategyMap = new ConcurrentHashMap<>(8);

    public boolean action(String goalTarget, Map<String, Object> param) {
        if (ObjectUtil.isNull(strategyMap.get(goalTarget))) {
            throw new JeecgBootException("未维护当前业务处理");
        }
        return strategyMap.get(goalTarget).operate(param);
    }

}
